# include "CRSmatrix.H"

using namespace std;
using namespace mg::numeric::algebra;

int main(){

  CRSmatrix<double> crs1("coo_matrix.mtx");
  
  crs1.print();
  cout << "--------------------------------------------------------------------------------" << endl;
  CRSmatrix<int> crs2("mat001.mtx");
  
  crs2.print();
  cout << "--------------------------------------------------------------------------------" << endl;
  CRSmatrix<int> crs3("mat002.mtx");
  
  crs3.print();
  cout << "--------------------------------------------------------------------------------" << endl;
  CRSmatrix<double> crs4("mat003.mtx");
  
  cout << "--------------------------------------------------------------------------------" << endl;
  crs4.print();
  
  cout << "--------------------------------------------------------------------------------" << endl;
  cout << crs1 ;
  cout << "--------------------------------------------------------------------------------" << endl;

  CRSmatrix<int> crs5("input17.dat");
  cout << "--------------------------------------------------------------------------------" << endl;
  cout << crs5 ;
  
  CRSmatrix<double> crs6("input24.dat");
  cout << crs6 ;
  cout << "--------------------------------------------------------------------------------" << endl;
 
  CRSmatrix<int> crs7 = {{11,12,0,14,0,0,0,0},{0,22,23,0,25,0,0,0},{31,0,33,34,0,0,0,0},
                              {0,42,0,0,45,46,0,0},{0,0,0,0,55,0,0,0},{0,0,0,0,65,66,67,0},{0,0,0,0,75,0,77,78},
                              {0,0,0,0,0,0,87,88}} ;

  cout << crs7 ;    
  cout << "--------------------------------------------------------------------------------" << endl;
  cout << "--------------------------------------------------------------------------------" << endl;
  
  CRSmatrix<double> crs8 = {{11.06,0,0,0,0,16.45,0,0,19.12,0},
                            {21.43, 0 ,0,0,0,0,0,0, 0.29 , 0}, 
                            {0,0,0,0,0,0,0,0,39.45,0},            
                            {0,0,0,0,45.22,0,0,0,0,0},
                            {0,0,0,54.12,0,0,0,0,0,0},
                            {0,0,0,0,0,0,0,0,69.67,0},
                            {0,0,0,0,0,0,0,0,0,0},
                            {81.13,0,0,0,0,0,0,0,0,0},
                            {0,0,0,0,0,0,0,0,0,0},
                            {0,0,0,0,0,0,0,0,0,0} };
    cout << crs8 ;   
   cout << "--------------------------------------------------------------------------------" << endl;
    cout << crs5 ;  
   cout << "--------------------------------------------------------------------------------" << endl;
   std::vector<int> v1 =  {3,4,0,1,6,8,1,19};    
   std::vector<int> v2 =  crs5*v1 ;
   
   for(auto& x : v2 )
      cout << x << ' ' ;
   std::cout << endl;   
   cout << "--------------------------------------------------------------------------------" << endl;
   CRSmatrix<double> crs9  = {{1.01, 0, 3.43, 0}, {   0, 4.07, 0, 0}, {0, 0, 0,  3.09}, {1.0, 2.4, 0,0}} ;  
   cout << "-------------------------------------------------------------------------------" << endl;
   CRSmatrix<double> crs10 = {{   0, 0, 1.21, 0}, {3.31,    0, 0, 0}, {0, 0, 0, -6.11}, {1.0, 2.2, 0,0}} ; 
   cout << "--------------------------------------------------------------------------------" << endl;
   cout << crs9  ;
   cout << "--------------------------------------------------------------------------------" << endl;
   cout << crs10 ;
   cout << "--------------------------------------------------------------------------------" << endl;
   CRSmatrix<double> crs11 = crs9*crs10 ;     
   cout << crs11 ;
   cout << "--------------------------------------------------------------------------------" << endl;
   CRSmatrix<double> crs13("input4.dat");
   cout << "--------------------------------------------------------------------------------" << endl;
   CRSmatrix<double> crs14("input8.dat");
   cout << "--------------------------------------------------------------------------------" << endl;
   
   std::vector<double> v3 =  {10,3,0,3,1,2}; 
   std::vector<double> v4 =  crs13*v3 ;
           
   for (auto & x : v4 )
     cout << x << ' ' ;
   cout <<endl;   
   cout << "--------------------------------------------------------------------------------" << endl;
   CRSmatrix<double> crs15 = crs14*crs13;
   cout << "--------------------------------------------------------------------------------" << endl;
   cout << crs15 ;   
   cout << "--------------------------------------------------------------------------------" << endl;
   CRSmatrix<double> crs16 = crs13*crs14;
   cout << crs16 ; 
  return 0;
}

/*
11 12 14 22 23 25 31 33 34 42 45 46 55 65 66 67 75 77 78 87 88 
0 1 3 1 2 4 0 2 3 1 4 5 4 4 5 6 4 6 7 6 7 
0 3 6 9 12 13 16 19 21 


1.01 3.43 4.07 3.09 1 2.4 
0 2 1 3 0 1 
0 2 3 4 6 



*/
